﻿#include "DialogSetCurve.h"
#include "SARibbonColorToolButton.h"
#include "ui_DialogSetCurve.h"
#include "colorWidgets//SAColorMenu.h"
DialogSetCurve::DialogSetCurve(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogSetCurve)
{
    ui->setupUi(this);
    colorButton = ui->toolButton;
    colorButton->setColor(QColor());
    colorButton->setColorStyle(SARibbonColorToolButton::ColorFillToIcon);
    SAColorMenu* menu=colorButton->setupStandardColorMenu();
    menu->setTitile("颜色板");
    connect(ui->widgetColorPalette,&SAColorPaletteGridWidget::colorClicked,[this](const QColor& c){
        ui->toolButton->setColor(c);
    });
}

DialogSetCurve::~DialogSetCurve()
{
    delete ui;
}

void DialogSetCurve::setTitle(const QString &s)
{
    ui->labelTitle->setText(s);
}

QColor DialogSetCurve::selectColor()
{
    return colorButton->color();
}

void DialogSetCurve::setSelectColor(const QColor &color)
{
    colorButton->setColor(color);
}
